﻿using CalendarApp.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace CalendarApp.Controllers
{
    public class CalendarController : Controller
    {
        //
        // GET: /Calendar/

        public ActionResult Index()
        {
            return View();
        }
        public ActionResult Day(int? year, int? month, int? day)
        {
            var date = DateTime.Now;
            if (year.HasValue && month.HasValue && day.HasValue) date = new DateTime((int)year, (int)month, (int)day);
            var model = new MonthDTO
            {
                DateToShow = date
            };
            return View(model);
        }
        public ActionResult Week(int? year, int? month, int? day)
        {
            var date = DateTime.Now;
            if (year.HasValue && month.HasValue && day.HasValue) date = new DateTime((int)year, (int)month, (int)day);
            var model = new MonthDTO
            {
                DateToShow = date
            };
            return View(model);
        }
        public ActionResult Month(int? year, int? month)
        {
            var date = DateTime.Now;
            if (year.HasValue && month.HasValue) date = new DateTime((int)year, (int)month, 1);
            var model = new MonthDTO
            {
                DateToShow = date
            };
            return View(model);
        }
    }
}
